package com.infra.micro.quartz.domain.service;

import com.infra.common.resp.Page;
import com.infra.common.resp.Response;
import com.infra.micro.quartz.domain.entity.QuartzJobPO;
import com.infra.micro.quartz.model.req.QueryQuartzJobReq;
import com.infra.micro.quartz.model.vo.QuartzJobVO;

import java.util.List;
import java.util.Set;

public interface QuartzJobService {
    /**
     * 根据暂停的状态查询列表
     *
     * @param isPause
     * @return
     */
    List<QuartzJobPO> queryList(boolean isPause);

    /**
     * 通过jobId更新暂停状态
     *
     * @param quartzJob
     * @return
     */
    boolean updateIsPause(QuartzJobVO quartzJob);

    /**
     * 创建Job
     *
     * @param resources
     * @return
     */
    Response<Boolean> create(QuartzJobVO resources);

    /**
     * 更新Job
     *
     * @param resources
     * @return
     */
    Response<Boolean> update(Long jobId, QuartzJobVO resources);

    /**
     * 立即执行job
     *
     * @param quartzJob
     */
    void execution(QuartzJobVO quartzJob);

    /**
     * 通过JobId批量删除
     *
     * @param jobIds
     */
    void batchDeleteByIds(Set<Long> jobIds);

    /**
     * 通过JobId删除
     *
     * @param jobId
     */
    boolean deleteById(Long jobId);

    /**
     * 通过jobId查询详情
     *
     * @param jobId
     * @return
     */
    Response<QuartzJobVO> queryById(Long jobId);

    /**
     * 分页查询
     *
     * @param page
     * @return
     */
    Response<Page<QuartzJobVO>> queryListByPage(QueryQuartzJobReq req);
}
